// app.js
App({
 
  //判断用户是否登录
   cp_login_if() {
     console.log('检测登录')
     let useruid = wx.getStorageSync('uid');
    // 根据缓存信息判断是否登录
     if (!useruid) {
       console.log('未登录')
       var _this = this; 
       wx.hideLoading();
       wx.showModal({
         title: "提示", content: "您还没有登录", showCancel: true, cancelText: "去注册", confirmText: "去登录", cancelColor: "#858484", confirmColor: "#ff5816",
         success: (res) => {
           console.log("====显示模态对话框  是否授权====")
           console.log(res)
           var cancel = res.cancel, confirm = res.confirm;
           if (confirm) { 
             //去登陆 
               wx.switchTab({
                       url: '/pages/mine/mine'
                })
           } else if (cancel || cancel == false) {
            //  wx.redirectTo({ url: '/pages/nologin/nologin' })
                wx.switchTab({
                  url: '/pages/mine/mine'
                })
           }
         }
       })
   
    }else{
       console.log('已登录')
      return true
    }
  },
//判断用户是否登录--结束
 
})
